package exercise6;
import javax.swing.JOptionPane;
public class Exercise6 {
	public static void main(String[] args) {
		JOptionPane.showMessageDialog(null,"实现风扇类");
		String str=JOptionPane .showInputDialog("请输入风扇的风速");
		int a=Integer.parseInt(str);
		JOptionPane.showInputDialog("请输入风扇的开关情况");
		boolean b=Boolean.parseBoolean(str);
		JOptionPane.showInputDialog("请输入风扇的半径");
		double c=Double.parseDouble(str);
		String s1=JOptionPane.showInputDialog("请输入风扇的颜色");
		Fan f=new Fan();
		f.setColor(s1);
		f.setOn(b);
		f.setRadius(c);
		f.setSpeed(a);
		JOptionPane.showMessageDialog(null,f);
		
		JOptionPane.showMessageDialog(null,"实现矩形类");
		String str1=JOptionPane.showInputDialog("请输入矩形的宽");
		double w=Double.parseDouble(str1);
		JOptionPane.showInputDialog("请输入矩形的长");
		double l=Double.parseDouble(str1);
		String s2=JOptionPane.showInputDialog("请输入矩形的颜色");
		Rectangle r=new Rectangle();
		r.setWidth(w);
		r.setHeight(l);
		r.setColor(s2);
		JOptionPane.showMessageDialog(null,r);
		
		JOptionPane.showMessageDialog(null,"进行数的判断");
		String str2=JOptionPane.showInputDialog("请输入一个数");
		int number=Integer.parseInt(str2);
		Int in=new Int(number);
		JOptionPane.showMessageDialog(null,"该数是不是质数 "+in.isPrime(number));
		JOptionPane.showMessageDialog(null,"该数是不是偶数 "+in.isEven(number));
		
		JOptionPane .showMessageDialog(null,"实现两点之间的距离");
		String str3=JOptionPane.showInputDialog("请输入p1的X");
		double p1_X=Double.parseDouble(str3);
		String str4=JOptionPane.showInputDialog("请输入p1的Y");
		double p1_Y=Double.parseDouble(str4);
		String str5=JOptionPane.showInputDialog("请输入p2的X");
		double p2_X=Double.parseDouble(str5);
		String str6=JOptionPane.showInputDialog("请输入p2的Y");
		double p2_Y=Double.parseDouble(str6);
		MyPoint p1=new MyPoint(p1_X, p1_Y);
		MyPoint p2=new MyPoint(p2_X, p2_Y);
		JOptionPane.showMessageDialog(null,"p1和p2之间的距离为"+new MyPoint().distance(p1, p2));
	}
}
